<?php
class DatePicker{
	//JQuery Attributes
	var $id;
	var $changeMonth;
	var $changeYear;
	var $inline;
	var $format;
	var $showButtonPanel;
	var $yearRange;
	public function __construct($id=""){
		$this->id = $id;
		$this->changeMonth=True;
		$this->changeYear =True;
		$this->inline = false;
		$this->format = 'd MM y';
		$this->showButtonPanel = True;
		$this->yearRange = 'c-30:c+30';
	}
	//IMPLEMENTED ABSTRACT METHOD
	public function renderHead(){
		return "$('#".$this->id."').datepicker({
					changeMonth		: ".$this->changeMonth.",
					changeYear 		: ".$this->changeYear.",
					dateFormat 		: '".$this->format."',
					showButtonPanel : ".$this->showButtonPanel.",
					yearRange		: '".$this->yearRange."'
				});";
	}
	public function renderBody(){
		if(!$this->inline){
			return "<input name=\"".$this->id."\" id=\"".$this->id."\"/>";
		}
		else
		{
			return "<div name=\"".$this->id."\" id=\"".$this->id."\"/>";
		}
	}
	//
	
	//PUBLIC ORDER
	public function setId($id){
		$this->id = $id;
	}
	public function setInline($inline){
		$this->inline = $inline;
	}
	public function setFormat($format){
		$this->format = $format;
	}
	public function setYearRange($past,$future){
		$this->yearRange = "c-$past:c+$future";
	}
	
}